#!/usr/bin/env python
#
# move this file to the bot directory

__copyright__ = 'this file is in the public domain'

from gozerbot.config import config
from gozerbot.generic import handle_exception
config['loglevel'] = 100
import unittest, glob, signal, os

# stop function
def stop(x, y):
    os._exit(0)

# register SIGTERM handler to stop
signal.signal(signal.SIGTERM, stop)

try:
    names =  map(lambda a: a[:-3], glob.glob('tests/*.py'))
    suite = unittest.defaultTestLoader.loadTestsFromNames(names)
    unittest.TextTestRunner(verbosity=2).run(suite)
except:
    handle_exception()
os._exit(0)
